package functii.elementare;

import operatori.Minus;
import operatori.Produs;
import functii.Functie;

public class Exponentiala extends Functie{
	public double calcul(double a, double b){
		return Math.pow(a, b);
	}
	public static double Calcul(double a, double b){
		return Math.pow(a, b);
	}
	public double calculDerivata(){
		if(fStang==null || fDrept==null)
			System.exit(1);
		return Produs.Calcul(fDrept.calcul(), Calcul(fStang.calcul(), Minus.Calcul(fDrept.calcul(), 1.0)));
	}
	public String derivare(){
		if(fStang==null || fDrept==null)
			System.exit(1);
		return Produs.concatTermens(concatTermens(fStang.toString(), Minus.concatTermens(fDrept.toString(), "1.0")), fDrept.toString());
	}
	public String concatTermeni(String a, String b){
		String aux;
		if(a.compareTo("0") == 0 && b.compareTo("0")==0)
			aux=a;
		else 
			if(a.compareTo("0")==0)
				aux="0";
			else
				if(b.compareTo("0")==0)
					aux="1";
				else 
					aux=a + "^" + b;
		return aux;
		//verifica daca sunt numere si se face calcul dintre ele
	}
	public static String concatTermens(String a, String b){
		String aux;
		if(a.compareTo("0") == 0 && b.compareTo("0")==0)
			aux=a;
		else 
			if(a.compareTo("0")==0)
				aux="0";
			else
				if(b.compareTo("0")==0)
					aux="1";
				else 
					aux=a + "^" + b;
		return aux;
	}
	@Override
	public double calcul() {
		// TODO Auto-generated method stub
		return 0;
	}
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return null;
	}
}
